<?php

namespace app\api\controller;

use app\BaseController;
use app\common\model\LiangBiaoModel;
use app\common\model\LiangBiaoOrderModel;

class  LiangBiaoOrder extends BaseController
{

    /**
     * @var  LiangBiaoOrderModel
     */
    private $model;

    public function initialize()
    {
        $this->model = new LiangBiaoOrderModel();
    }

    /**
     * 患者列表
     */
    public function create()
    {
        $result                     = [
            "status" => "no",
            "data"   => [],
            "msg"    => "查找失败"
        ];
        $insertData                 = [
            'liangbiao_id'    => $this->request->param("liangbiao_id", 0),
            'patient_id'     => $this->request->param("patient_id", 0),
        ];
        if(empty($insertData['liangbiao_id'])){
            $result['msg'] = '量表id参数缺少';
            return $result;
        }
        if(empty($insertData['patient_id'])){
            $result['msg'] = '患者id参数缺少';
            return $result;
        }
        $result                     = $this->model->saveData($insertData);
        return json($result);
    }

    //检查是否登录
    private function checkLogin()
    {
        $result = [
            "status" => "noLogin",
            "data" => [],
            "msg" => "请登录"
        ];

        if ($this->user == null) {
            return json($result);
        }
    }
}